import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static String myPrint(double n, int t1) {
        String s = "%." + String.valueOf(t1) + "f";
        return String.format(s, n);
    }

    public static String myPrint(double n, int t1, int t2) {
        String s = "%" + String.valueOf(t1) + "." + String.valueOf(t2) + "f";
        return String.format(s, n);
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] nums1 = new int[n];
        for (int i = 0; i < n; i++) {
            nums1[i] = scanner.nextInt();
        }
        int m = scanner.nextInt();
        int[] nums2 = new int[n];
        for (int i = 0; i < n; i++) {
            int index = (i + m) % n;
            nums2[index] = nums1[i];
        }
        for(int i=0;i<n;i++){
            System.out.print(nums2[i] + " ");
        }
    }
}